package com.yanqu.road.server.cmd.activity.areapk;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cross3.activity.AreaWashePkProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.area.AreaWasePkMgr;
import com.yanqu.road.server.manger.activity.entername.EnterNameActivityMgr;
import com.yanqu.road.server.pb.PlayerPb;
import com.yanqu.road.server.protocol.ChannelProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_AREA_WASHE_PK_DATA_GET,desc = "玩家数据获取")
public class AreaWashePkGetUserDataCmd extends AbstractCommand {


    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ActivityInfo activityInfo = AreaWasePkMgr.getActivityInfo();
        if(!ActivityMgr.activityInShowTime(activityInfo)){
            return;
        }
        //系统解锁
        if(!EnterNameActivityMgr.isActivitySystemOpen(player, activityInfo)){
            return;
        }
        AreaWashePkProto.ChannelAreaWashePkGetUserDataReq.Builder channelReq = AreaWashePkProto.ChannelAreaWashePkGetUserDataReq.newBuilder();
        channelReq.setUserKey(EnterNameActivityMgr.buildKeyMsg(player.getUserId()));
        channelReq.setActivityId(activityInfo.getActivityId());
        channelReq.setUserBaseInfo(PlayerPb.parsePlayerBaseTempMsg(player.getUserInfo()));
        player.sendChannelPacket(ChannelProtocol.N_AREA_WASHE_PK_DATA_GET, channelReq);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
